package controllers;

import play.*;
import play.mvc.*;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.*;

import models.*;

public class Application extends Controller {

	private static Connection conexao;
	private static Statement comando;

	/***********************************************************************************/

	protected static void conectar() throws SQLException {  
	      
	  	  
		try {
			Class.forName("org.postgresql.Driver");
		} catch (ClassNotFoundException e) {
		}
	
			conexao = DriverManager.getConnection(  
			        "jdbc:postgresql://localhost:5432/SGRv2",  
			        "postgres",  
			        "senha");
		
			comando =  conexao.createStatement();

}
	
	/***********************************************************************************/

	public static void testarconexao(String login, String senha) throws SQLException {
		
		conectar();
		
		ResultSet cli = comando.executeQuery("select * from pessoa");

		while(cli.next())
		{
			System.out.println(cli.getString("nomepessoa"));
			
		}
		
		
	}
	
	/***********************************************************************************/

    public static void index() {
 
    	login.Login();
    	
    }
    
	/***********************************************************************************/

    
}


